function snr = narrow_signal_noise_ratio(fftdata,freq,Fs)
%SNR 计算窄带信噪比
% fftdata: 输入的单边频谱数据,行为采样点，列为通道
% freq:信号频率
% Fs:采样频率
deltaf = Fs/size(fftdata,1)/2;
signalPower = fftdata(round(freq/deltaf)+1,:)';
totalPower = sum(fftdata(round((freq-1)/deltaf)+1:round((freq+1)/deltaf)+1,:),1)'; 
noisePower = (totalPower - signalPower)/(round((freq+1)/deltaf) - round((freq-1)/deltaf));
snr = mean(20*log(signalPower./noisePower));
end